#include <iostream>
#include <vector>
using namespace std;

//  97.22 %
class Solution
{
  public:
	int singleNumber(vector<int> &nums)
	{
		for (int i = 1; i < nums.size(); i++)
		{
			nums[i] ^= nums[i - 1];
		}
		return nums[nums.size() - 1];
	}
};

int main()
{
	int arr[] = {4, 1, 2, 1, 2};
	int n = sizeof(arr) / sizeof(arr[0]);
	vector<int> myVector(arr, arr + n);
	cout << Solution().singleNumber(myVector) << endl;
	return 0;
}
